package cn.edu.nju.software.zp13.assignment6.service.soapMessage;

import java.util.Locale;

import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFault;

import cn.edu.nju.software.zp13.assignment5.service.soapMessage.SOAPMsgProducer;

public class IllegalUpdateSOAPMsgProducer extends SOAPMsgProducer {
	@Override
	public void processSOAPMsg() {
		try {
			SOAPEnvelope envelope = this.soapMessage.getSOAPPart().getEnvelope();
			SOAPBody body = envelope.getBody();
			SOAPFault fault = body.addFault();
			fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
			fault.addFaultReasonText("courseScore record does not exist!", Locale.US);
		} catch (SOAPException e) {
			e.printStackTrace();
		}
	}
}
